import Vue from 'vue'
import Router from 'vue-router'
import Login from '../../renderer/components/Login'
import Home from '../../renderer/components/Home'
import Module from '../../renderer/components/Module'
import User from '../components/User'
import MetManagement from '../components/MetManagement'
import Order from '../components/module/Order'

const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Login',
      component: Login
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      children: [
        {
          path: '/module',
          component: Module
        },
        {
          path: '/user',
          name: 'user',
          component: User
        },
        {
          path: '/met',
          name: 'met',
          component: MetManagement
        },
        {
          path: '/order',
          name: 'order',
          component: Order
        }
      ]
    }]
})
